﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Web;
//using System.Web.UI;
//using System.Web.UI.WebControls;
//using Touch2Like.DAL;
//using Touch2Like.Model;
//using Touch2Like.SharedLibrary;

//namespace Touch2Like.Web.Customer.Popup
//{
//    public partial class AddAddress : System.Web.UI.Page
//    {
//        protected void Page_Load(object sender, EventArgs e)
//        {
//            if (!IsPostBack)
//            {
//                if (!string.IsNullOrEmpty(Request["ListID"]))
//                {
//                    CommonAddress address = new CommonAddress();
//                    CommonAddressInfo info = address.GetByID(Convert.ToInt32(Request["ListID"]));

//                    if (info != null)
//                    {
//                        tb_FirstName.Text = info.FirstName;
//                        tb_LastName.Text = info.LastName;
//                        tb_Company.Text = info.Company;
//                        tb_Address.Text = info.Address;
//                        tb_Address2.Text = info.Address2;
//                        tb_City.Text = info.City;
//                        tb_Postal.Text = info.Postal;
//                        ddl_Country.SelectedValue = info.Country;
//                        ddl_State.SelectedValue = info.State;
//                        tb_Phone.Text = info.Phone;
//                        tb_Email.Text = info.Email;
//                    }
//                }
//            }
//        }

//        protected void btn_Submit_Click(object sender, EventArgs e)
//        {
//            CommonAddress address = new CommonAddress();
//            CommonAddressInfo info = new CommonAddressInfo();

//            if (!string.IsNullOrEmpty(Request["ListID"]))
//            {
//                info = address.GetByID(Convert.ToInt32(Request["ListID"]));

//                if (info != null)
//                {
//                    info.FirstName = tb_FirstName.Text;
//                    info.LastName = tb_LastName.Text;
//                    info.Company = tb_Company.Text;
//                    info.Address = tb_Address.Text;
//                    info.Address2 = tb_Address2.Text;
//                    info.City = tb_City.Text;
//                    info.Postal = tb_Postal.Text;
//                    info.Country = ddl_Country.SelectedValue;
//                    info.State = ddl_State.SelectedValue;
//                    info.Phone = tb_Phone.Text;
//                    info.Email = tb_Email.Text;
//                    info.UserID = WebUtility.UserGUID;
//                    address.Update(info);
//                }
//            }
//            else
//            {
//                info.FirstName = tb_FirstName.Text;
//                info.LastName = tb_LastName.Text;
//                info.Company = tb_Company.Text;
//                info.Address = tb_Address.Text;
//                info.Address2 = tb_Address2.Text;
//                info.City = tb_City.Text;
//                info.Postal = tb_Postal.Text;
//                info.Country = ddl_Country.SelectedValue;
//                info.State = ddl_State.SelectedValue;
//                info.Phone = tb_Phone.Text;
//                info.Email = tb_Email.Text;
//                info.UserID = WebUtility.UserGUID;
//                address.Add(info);
//            }

//            ClientScript.RegisterStartupScript(this.GetType(), "update", "<script>top.document.location.href=top.document.location.href;top.document.location.reload();</script>");
//        }
//    }
//}